#ifndef _SYS_DECIMAL_H_
#define _SYS_DECIMAL_H_

#include "FanNum.h"
#include "SysTypes.h"

#define DECIMAL_VTABLE(self)   ((DecimalVTable*)((FanObj*)self)->vtable)


extern Type*    Decimal_classType;
extern VTable*  Decimal_classVTable;


/* [sys::Decimal] Attributes */
struct Decimal
{
  FanNum        super;
  double        val;
};


/* [sys::Decimal] Virtual-table */
typedef struct DecimalVTable
{
  FanNumVTable  super;
} DecimalVTable;


/* [sys::Decimal] Methods and fields */
Bool            Decimal_equals(Obj self, NullableObj obj);
Int             Decimal_compare(Obj self, Obj obj);
Int             Decimal_hash(Obj self);
Str*            Decimal_toStr(Obj self);
Decimal*        Decimal_defVal(void);
Decimal*        Decimal_fromStr_1(Str* s);
Decimal*        Decimal_fromStr(Str* s, Bool checked);
Decimal*        Decimal_negate(Decimal* self);
Decimal*        Decimal_increment(Decimal* self);
Decimal*        Decimal_decrement(Decimal* self);
Decimal*        Decimal_mult(Decimal* self, Decimal* b);
Decimal*        Decimal_multInt(Decimal* self, Int b);
Decimal*        Decimal_multFloat(Decimal* self, Float b);
Decimal*        Decimal_div(Decimal* self, Decimal* b);
Decimal*        Decimal_divInt(Decimal* self, Int b);
Decimal*        Decimal_divFloat(Decimal* self, Float b);
Decimal*        Decimal_mod(Decimal* self, Decimal* b);
Decimal*        Decimal_modInt(Decimal* self, Int b);
Decimal*        Decimal_modFloat(Decimal* self, Float b);
Decimal*        Decimal_plus(Decimal* self, Decimal* b);
Decimal*        Decimal_plusInt(Decimal* self, Int b);
Decimal*        Decimal_plusFloat(Decimal* self, Float b);
Decimal*        Decimal_minus(Decimal* self, Decimal* b);
Decimal*        Decimal_minusInt(Decimal* self, Int b);
Decimal*        Decimal_minusFloat(Decimal* self, Float b);
Decimal*        Decimal_abs(Decimal* self);
Decimal*        Decimal_min(Decimal* self, Decimal* that);
Decimal*        Decimal_max(Decimal* self, Decimal* that);
Str*            Decimal_toCode(Decimal* self);
Str*            Decimal_toLocale_0(Decimal* self);
Str*            Decimal_toLocale(Decimal* self, Str* pattern);


/* [sys::Decimal] Extra methods */
Decimal*        Decimal_new(double val);


/* [sys::Decimal] Type-system functions */
Type*           Decimal_initType(void);
VTable*         Decimal_initVTable(void);
void            Decimal_initStatic(void);


#endif
